import { nanoid } from 'nanoid'
export default class ProcessMemory{
    // 内存空间唯一标识
    memoryId
    // 内存块
    data
    // 内存空间对应的进程Id
    processId
    constructor(processId){
        if(processId) this.processId = processId
        else console.log("please set processId for memory")
        this.data = new Map()
        this.memoryId = nanoid().replace(/[0-9-]/g).replace(/undefined/g,'')
    }
    getMemoryId(){
        return this.memoryId
    }
    set(key,val){
        this.data.set(key,val)
    }
    get(key){
        this.data.get(key)
    }
}